layui.use(['layer', 'form', 'admin', 'laydate', 'HttpRequest', 'address'], function () {
    var $ = layui.jquery;
    var HttpRequest = layui.HttpRequest;
    var form = layui.form;
    var admin = layui.admin;
    $(function() {
        let studentId = Feng.getUrlParam("studentId");
        if (studentId === null){
            admin.closeThisDialog();
        }
        let httprequest = new HttpRequest(Feng.ctxPath + '/student/printdetail?id=' + studentId, 'get');
        let result = httprequest.start();
        let mainData = result.data;
        if (mainData === null){
            if (studentId !=null){
                Feng.error("数据获取失败。 reason: " + result.message);
            }
        }
        let studentObj = mainData.student;
        let sex = studentObj.sex;
        if (sex ==='M'){
            studentObj.sex = '男'
        }else{
            studentObj.sex = '女'
        }
        studentObj.birthday = studentObj.birthday.replace('00:00:00','').trim();
        studentObj.address = mainData.addressArea+studentObj.address;
        mainData.accordRegistered === false? mainData.accordRegistered = '否':mainData.accordRegistered = '是';
        mainData.accordHouse === false? mainData.accordHouse = '否':mainData.accordHouse = '是';
        form.val('studentPrintForm', studentObj);
        form.val('studentPrintForm', mainData);
    });

    $('#close').click(function (data) {
        admin.closeThisDialog();
    });
});
